package com.spring.demo4;

import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class MainApp {

	/**
	 * 注入 List Set Map。。。
	 */
	public void testDemo2(){
		AbstractApplicationContext context = new FileSystemXmlApplicationContext("src/test/resources/bean4.xml");
		JavaCollection jc = (JavaCollection) context.getBean("javaCollection");
		jc.getAddressList();
		jc.getAddressSet();
		jc.getAddressMap();
		jc.getAddressProp();
	}
	public void testDemo1(){
		AbstractApplicationContext context = new FileSystemXmlApplicationContext("src/test/resources/bean4.xml");
		B b = (B) context.getBean("b");
		System.out.println(b.getBb());
		System.out.println(b.getA().getAa());
		System.out.println("=====***************====");
		C c = (C) context.getBean("c");
		System.out.println(c.getMap().get("bbb").getA().getAa());
		System.out.println(c.getMap().get("bbb2").getA().getAa());
		System.out.println(c.getMap().get("bbb").getD().getD());
		System.out.println(c.getMap().get("bbb2").getD().getD());
	}
	public static void main(String[] args) {
		new MainApp().testDemo2();
		System.out.println("=========================");
		new MainApp().testDemo1();
	}
}
